home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
doors_1
/
bbs_time.zip
/
BBS_TIME.DOC
< prev
next >
Wrap
Text File
|
1991-06-16
|
8KB
|
208 lines
BBS Time Utilities
Three time utilities to facilitate operation
of DOS based BBS's and other 24 hour per day
operations.
IS_DST
ADJ_TIME
TIMECHEK
Copyright 1991, Steve Antonoff
3917 Garfield Dr.
Stone Mountain, GA 30083
FIDOnet: 1:133/302
EGGnet: 99:9000/6
June 16, 1991
BBS Time Utilities by Steve Antonoff
IS_DST - checks for Daylight Savings Time in the USA
ADJ_TIME - adjusts DOS system clock by n hours (positive or
negative)
IS_DST and ADJ_TIME were writted to accommodate the semi-annual
insanity of changing the clock.
IS_DST will check the current DATE and determine if the Daylight
Savings Time is in effect, based on current (6/16/91) laws of the
USA which define Daylight Savings Time as being in effect from
the first Sunday in April through the last Sunday in October.
IS_DST does NOT check for the time of day (that is, it assumes
that the time change occurs at midnight, not at 2AM). As a result
of this, it is best if it is NOT run between midnight and 1:00
A.M. More on this later!
ADJ_TIME will adjust the system clock forward or backward the
specified number of hours. There are two common uses for
ADJ_TIME: (1) daylight savings time on/off and (2) changing time
zones for portable computers.
Usage:
IS_DST will set the DOS errorlevel to 1 if Daylight Savings Time
is in effect; it will set the errorlevel to 0 if Daylight Savings
Time is NOT in effect. Here's how I use IS_DST in my
AUTOEXEC.BAT file:
is_dst
if errorlevel 1 got DST
set TZ=EST5
del c:\EDT
echo x>c:\EST
goto TZCONTINUE
:DST
del C:\EST
echo x>c:\EDT
set TZ=EDT4
:TZCONTINUE
The flag files (EDT and EST) are used to keep track of what time
was in effect when the system last booted. These files will
enable the BBS to automatically adjust its time when the time
changes.
Copyright 1991, Steve Antonoff, Stone Mountain, GA
Page 1
BBS Time Utilities by Steve Antonoff
My nightly cleanup starts at 2:15 AM, a perfect time to check for
the start or end of Daylight Savings Time. So, in my CLEANUP.BAT
file, which is executed at 2:15 AM every night by my BINK.BAT
file, I have:
---------------------------------------------------------------
rem check to see if between midnight and 1 am - for safety sake
timechek -r 00:00 01:00
if errorlevel 1 goto TZEND
is_dst
if errorlevel 1 goto DST
:EST
rem Eastern Standard Time is in effect
rem if C:\EST exists, don't do anything
if exist c:\est goto TZEND
rem Change from DAYLIGHT to STANDARD time!
rem Set TZ variable
set TZ=EST5
rem Adjust system clock
adj_time -1
rem delete EDT flag file
del c:\edt
rem create EST flag file
echo x>c:\est
goto TZEND
:EDT
rem Eastern Daylight Time is in effect
rem if C:\EDT exists, don't do anything
if exist c:\edt goto TZEND
rem Change from STANDARD to DAYLIGHT time!
rem Set TZ variable
set TZ=EDT4
rem Adjust system clock
adj_time 1
rem delete EST flag file
del c:\est
rem create EDT flag file
echo x>c:\edt
:TZEND
---------------------------------------------------------------
Ok, why the check for times between midnight and 1AM? Here's
what could happen (an unlikely scenario, but Murphy lives at my
house!):
Suppose the for some reason, (system crash or locked up, etc) the
cleanup procedure is run between midnight and 1AM, and it is
going to make the time adjustment from Daylight Savings Time to
Standard Time. Without the trap, the time would be adjusted back
an hour, to a time BEFORE MIDNIGHT. Because of the way ADJ_TIME
was written, the date is adjusted correctly, making it between
11PM and midnight on the previous day. Well, now IS_DST will
Copyright 1991, Steve Antonoff, Stone Mountain, GA
Page 2
BBS Time Utilities by Steve Antonoff
report that it IS daylight savings time, again, and the process
could loop for an hour, changing from Daylight to Standard and
back again! So, it is safest to use TIMECHK to eliminate the
possibility of moving the time between midnight and 1AM. I
suppose I could have written IS_DST to check for the time on the
acutal switch-over day, but, hell, this is a hobby, ain't
it?
Pseudo Legalese:
Both IS_DST and ADJ_TIME are hereby released for non-commercial
public use and distribution. Commercial users, please contact
the author at one of the addresses below. All rights reserved.
The programs and this documentation are Copyright, 1991, by Steve
Antonoff.
To contact the Author:
As of the time of release of this software, the author can be
contacted by normal mail at:
Steve Antonoff
3917 Garfield Dr.
Stone Mountain, GA 30083
or via FIDOnet at address 1:133/302 or EGGnet at 99:9000/6. My
BBS phone number is (404) 296-9681. All of the above is subject
to change, of course.
Warranty:
These programs are guaranteed not to cause solar flares on Gamma
Hydra 4 (or was it Gamma Hydra 2?) Other than that, the programs
are provided as-is. Bug reports and/or modification requests
will be considered on an "as time permits" basis by the author.
Non-USA considerations:
As previously indicated, IS_DST will only perform correctly in
the United States of America, and even there only as long as
Congress doesn't mess with the laws regarding Daylight Savings
Time. Should non-USA sysops wish to make use of IS_DST, I will
consider adding other country's or region's rules if someone will
define them to me properly.
Miscellaneous:
TIMECHEK has been included in BBS_TIME.ZIP just to form a com-
plete set; the only changes were to bring the source code up to
ANSI C standards and to make the copyright notice consistent with
ADJ_TIME and IS_DST.
Copyright 1991, Steve Antonoff, Stone Mountain, GA
Page 3